package com.guigu.controller.lq.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.controller.lq.mapper.LqVisitMapper;
import com.guigu.controller.lq.pojo.LqPhysicaljg;
import com.guigu.controller.lq.pojo.LqVisit;
import com.guigu.controller.lq.pojo.PageVO;
import com.guigu.controller.lq.service.LqVisitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LqVisitServiceimpl implements LqVisitService {
    @Autowired
    LqVisitMapper lqVisitMapper;
    public PageVO<LqVisit> findsf(Integer page, Integer num, String vipname) {
        PageHelper.startPage(page,num);
        LqVisit lqVisit = new LqVisit();
        lqVisit.setVipname(vipname);
        List<LqVisit> findsf = lqVisitMapper.findsf(lqVisit);
        PageInfo<LqVisit> pageInfo = new PageInfo<LqVisit>(findsf);
        long total = pageInfo.getTotal();
        PageVO<LqVisit> PageVO = new PageVO<LqVisit>();
        PageVO.setTotal(total);
        PageVO.setRows(findsf);
        return PageVO;
    }

    public int addsf(LqVisit lqVisit) {
        return lqVisitMapper.insert(lqVisit);
    }

    public int upsf(LqVisit lqVisit) {
        return lqVisitMapper.updateByPrimaryKey(lqVisit);
    }

    public LqVisit selsf(Integer id) {
        return lqVisitMapper.selsf(id);
    }

    public int delsf(Integer id) {
        return lqVisitMapper.deleteByPrimaryKey(id);
    }
}
